/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.infotypes;

/**
 * InitInfo.
 * 
 * Used to transmit player initialisation information at game start.
 * Not REALLY an aural info but fits best into this category.
 */
public class InitInfo extends AuralInfo {

	/**
	 * The tricot number of the agent. This is assigned by the server
	 * in the order of initialization (1..11).
	 */
	private int number = -1;

	/**
	 * A flag indicating, if the player is a goalie. This is set true, if the
	 * player connected successfully as goalie.
	 */
	private boolean isGoalie;

	/**
	 * The teamname, with which the agent connected to the server.
	 */
	private String teamName = "NO TEAMNAME IN INIT";

	/**
	 * Constructs an init-info object which is received after connecting to the
	 * server.
	 * 
	 * @param iCycle -
	 *            the cycle, when it was received
	 * @param iNumber -
	 *            the given number <unum> from the server.
	 * @param iIsGoalie -
	 *            if we are goalie or not
	 */
	public InitInfo(int iCycle, int iNumber, boolean iIsGoalie) {
		super(iCycle);
		this.number = iNumber;
		this.isGoalie = iIsGoalie;
		this.infoType = TYPE_INIT;
	}

	/**
	 * Constructs an init-info object which is received after connecting to the
	 * server.
	 * 
	 * @param iCycle -
	 *            the cycle, when it was received
	 * @param iNumber -
	 *            the given number <unum> from the server.
	 * @param iIsGoalie -
	 *            if we are goalie or not
	 * @param iTeamName -
	 *            the team-name
	 */
	public InitInfo(int iCycle, int iNumber, boolean iIsGoalie, String iTeamName) {
		super(iCycle);
		this.number = iNumber;
		this.isGoalie = iIsGoalie;
		this.teamName = iTeamName;
		this.infoType = TYPE_INIT;
	}

	/**
	 * Setter for the tricot number
	 * @param number
	 */
	public void setNumber(int number) {
		this.number = number;
	}

	/**
	 * @return player number transmitted through the info message
	 */
	public final int number() {
		return this.number;
	}

	/**
	 * @return true if player is goalie
	 */
	public final boolean isGoalie() {
		return this.isGoalie;
	}

	/**
	 * @return Returns the teamName.
	 */
	public final String getTeamName() {
		return this.teamName;
	}

	/**
	 * @return A debug string for this info.
	 */
	@Override
	public String toString() {
		return ("PlayerInfo: Number: " + this.number + ", isGoalie: "
				+ (this.isGoalie ? "yes" : "no") + ", TeamName: " + this.teamName);
	}
}
